package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.Role;
import com.zzyl.vo.RoleVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleMapper {
    Page<RoleVo> page(Role role);

    @Select("select resource_no from sys_role_resource where role_id = #{roleId}")
    List<String> findCheckedResources(Long roleId);

    @Select("select * from sys_role")
    List<RoleVo> selectAll();

    @Delete("Delete from sys_role_resource where  role_id = #{roleId}")
    void deleteById(Long roleId);

    void update(Role role);

    void insert(Role role);

    @Select("select * from sys_role where id = #{roleIds}")
    Role getById(Long roleIds);

    @Delete("delete from sys_role where id = #{roleIds}")
    void delete(Long roleIds);
}
